Integrand size = 39, antiderivative size = 51 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {C x}{a}+\frac {A \text {arctanh}(\sin (c+d x))}{a d}-\frac {(A-B+C) \sin (c+d x)}{d (a+a \cos (c+d x))} \]
Leaf count is larger than twice the leaf count of optimal. \(163\) vs. \(2(51)=102\).
Time = 1.47 (sec) , antiderivative size = 163, normalized size of antiderivative = 3.20 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {4 \cos \left (\frac {1}{2} (c+d x)\right ) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right ) \left (C d x-A \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+A \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )-(A-B+C) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )\right )}{a d (1+\cos (c+d x)) (2 A+C+2 B \cos (c+d x)+C \cos (2 (c+d x)))} \]
(4*Cos[(c + d*x)/2]*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2)*(Cos[(c + d*x) /2]*(C*d*x - A*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + A*Log[Cos[(c + d *x)/2] + Sin[(c + d*x)/2]]) - (A - B + C)*Sec[c/2]*Sin[(d*x)/2]))/(a*d*(1 + Cos[c + d*x])*(2*A + C + 2*B*Cos[c + d*x] + C*Cos[2*(c + d*x)]))
Time = 0.43 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.02, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {3042, 3520, 3042, 3214, 3042, 4257}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\sec (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a \cos (c+d x)+a} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2}{\sin \left (c+d x+\frac {\pi }{2}\right ) \left (a \sin \left (c+d x+\frac {\pi }{2}\right )+a\right )}dx\) |
\(\Big \downarrow \) 3520 |
\(\displaystyle \frac {\int (a A+a C \cos (c+d x)) \sec (c+d x)dx}{a^2}-\frac {(A-B+C) \sin (c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {a A+a C \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2}-\frac {(A-B+C) \sin (c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3214 |
\(\displaystyle \frac {a A \int \sec (c+d x)dx+a C x}{a^2}-\frac {(A-B+C) \sin (c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {a A \int \csc \left (c+d x+\frac {\pi }{2}\right )dx+a C x}{a^2}-\frac {(A-B+C) \sin (c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 4257 |
\(\displaystyle \frac {\frac {a A \text {arctanh}(\sin (c+d x))}{d}+a C x}{a^2}-\frac {(A-B+C) \sin (c+d x)}{d (a \cos (c+d x)+a)}\) |
(a*C*x + (a*A*ArcTanh[Sin[c + d*x]])/d)/a^2 - ((A - B + C)*Sin[c + d*x])/( d*(a + a*Cos[c + d*x]))
3.4.43.3.1 Defintions of rubi rules used
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d Int[1/(c + d *Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(a*A - b*B + a*C)*Cos[e + f*x]*(a + b* Sin[e + f*x])^m*((c + d*Sin[e + f*x])^(n + 1)/(f*(b*c - a*d)*(2*m + 1))), x ] + Simp[1/(b*(b*c - a*d)*(2*m + 1)) Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*Simp[A*(a*c*(m + 1) - b*d*(2*m + n + 2)) + B*(b*c*m + a *d*(n + 1)) - C*(a*c*m + b*d*(n + 1)) + (d*(a*A - b*B)*(m + n + 2) + C*(b*c *(2*m + 1) - a*d*(m - n - 1)))*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c ^2 - d^2, 0] && LtQ[m, -2^(-1)]
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]
Time = 2.79 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.18
method | result | size |
parallelrisch | \(\frac {-A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (-A +B -C \right )+d x C}{a d}\) | \(60\) |
derivativedivides | \(\frac {-A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C +A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+2 C \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) | \(86\) |
default | \(\frac {-A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C +A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+2 C \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) | \(86\) |
risch | \(\frac {C x}{a}-\frac {2 i A}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {2 i C}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a d}-\frac {A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a d}\) | \(120\) |
norman | \(\frac {\frac {C x}{a}+\frac {C x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {2 C x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {\left (A -B +C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}-\frac {2 \left (A -B +C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}-\frac {\left (A -B +C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a d}-\frac {A \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a d}\) | \(174\) |
(-A*ln(tan(1/2*d*x+1/2*c)-1)+A*ln(tan(1/2*d*x+1/2*c)+1)+tan(1/2*d*x+1/2*c) *(-A+B-C)+d*x*C)/a/d
Time = 0.29 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.78 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {2 \, C d x \cos \left (d x + c\right ) + 2 \, C d x + {\left (A \cos \left (d x + c\right ) + A\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (A \cos \left (d x + c\right ) + A\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (A - B + C\right )} \sin \left (d x + c\right )}{2 \, {\left (a d \cos \left (d x + c\right ) + a d\right )}} \]
1/2*(2*C*d*x*cos(d*x + c) + 2*C*d*x + (A*cos(d*x + c) + A)*log(sin(d*x + c ) + 1) - (A*cos(d*x + c) + A)*log(-sin(d*x + c) + 1) - 2*(A - B + C)*sin(d *x + c))/(a*d*cos(d*x + c) + a*d)
\[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\int \frac {A \sec {\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx + \int \frac {C \cos ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx}{a} \]
(Integral(A*sec(c + d*x)/(cos(c + d*x) + 1), x) + Integral(B*cos(c + d*x)* sec(c + d*x)/(cos(c + d*x) + 1), x) + Integral(C*cos(c + d*x)**2*sec(c + d *x)/(cos(c + d*x) + 1), x))/a
Leaf count of result is larger than twice the leaf count of optimal. 146 vs. \(2 (51) = 102\).
Time = 0.29 (sec) , antiderivative size = 146, normalized size of antiderivative = 2.86 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {C {\left (\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} + A {\left (\frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} + \frac {B \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}}{d} \]
(C*(2*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a - sin(d*x + c)/(a*(cos(d*x + c) + 1))) + A*(log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a - sin(d*x + c)/(a*(cos(d*x + c) + 1))) + B *sin(d*x + c)/(a*(cos(d*x + c) + 1)))/d
Time = 0.34 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.80 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\frac {{\left (d x + c\right )} C}{a} + \frac {A \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {A \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} - \frac {A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a}}{d} \]
((d*x + c)*C/a + A*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a - A*log(abs(tan(1/ 2*d*x + 1/2*c) - 1))/a - (A*tan(1/2*d*x + 1/2*c) - B*tan(1/2*d*x + 1/2*c) + C*tan(1/2*d*x + 1/2*c))/a)/d
Time = 1.44 (sec) , antiderivative size = 113, normalized size of antiderivative = 2.22 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x)}{a+a \cos (c+d x)} \, dx=\frac {2\,A\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+2\,C\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{a\,d}-\frac {A\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-B\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+C\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a\,d\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )} \]